﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mayn.Video
{
    public class DbClient
    {
        public static SqlSugarClient Db
        {
            get
            {
                string connstring = Common.appSettingVale("MES");
                var sugarClient = new SqlSugarClient(new ConnectionConfig()
                {
                    ConnectionString = connstring,
                    DbType = DbType.MySql,
                    IsAutoCloseConnection = true,
                    InitKeyType = InitKeyType.SystemTable
                });

                //调式代码 用来打印SQL 
                //sugarClient.Aop.OnLogExecuting = (sql, pars) =>
                //{
                //    string executableSql = FormatHelper.FormatParam(sql, pars);
                //};
                return sugarClient;
            }
        }
    }
}
